{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import torch\n",
    "import torch.nn as nn\n",
    "\n",
    "#Standard model class\n",
    "class LinearModel(nn.Module):\n",
    "    def __init__(self, in_dim, out_dim):\n",
    "        super(LinearModel, self).__init__()\n",
    "        self.linear = nn.Linear(in_dim, out_dim)\n",
    "        \n",
    "    def forward(self,x):\n",
    "        out = self.linear(x)\n",
    "        return out\n",
    "    \n",
    "model = LinearModel(1, 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "learnRate = 0.01\n",
    "optimiser =  torch.optim.SGD(model.parameters(), lr =learnRate)\n",
    "criterion = nn.MSELoss()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x_train=torch.tensor([i for i in range(10)], dtype = torch.float).reshape(-1,1)\n",
    "#x_train = torch.randn(10).reshape(-1,1)\n",
    "#x_train = torch.tensor([1,2,3,4,5,6,7,8,9,10], dtype=torch.float).reshape(-1,1)\n",
    "y_train = torch.tensor([3*x*+5 for x in x_train]).reshape(-1,1) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[ 0.4756],\n",
      "        [-0.0545],\n",
      "        [-0.5846],\n",
      "        [-1.1147],\n",
      "        [-1.6448],\n",
      "        [-2.1749],\n",
      "        [-2.7049],\n",
      "        [-3.2350],\n",
      "        [-3.7651],\n",
      "        [-4.2952]])\n"
     ]
    }
   ],
   "source": [
    "out = model(x_train) \n",
    "print(out)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[ 0.6768, -0.4114],\n",
      "        [ 0.6768, -0.4114]])\n",
      "Parameter containing:\n",
      "tensor([-0.2489,  0.3994])\n",
      "Parameter containing:\n",
      "tensor([[ 0.1746,  0.5742,  0.1770],\n",
      "        [-0.4670, -0.1187, -0.2250]])\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "import torch.nn as nn\n",
    "x = torch.ones(2,3, dtype=torch.float)\n",
    "lin=nn.Linear(3, 2)\n",
    "print(lin(x))\n",
    "print(lin.bias)\n",
    "print(lin.weight)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch0, loss 6807.48583984375\n",
      "epoch1, loss 1178.037841796875\n",
      "epoch2, loss 205.45703125\n",
      "epoch3, loss 37.40979766845703\n",
      "epoch4, loss 8.355867385864258\n",
      "epoch5, loss 3.315117359161377\n",
      "epoch6, loss 2.423192262649536\n",
      "epoch7, loss 2.2482521533966064\n",
      "epoch8, loss 2.1974263191223145\n",
      "epoch9, loss 2.1682708263397217\n",
      "epoch10, loss 2.1430888175964355\n",
      "epoch11, loss 2.11881685256958\n",
      "epoch12, loss 2.0949337482452393\n",
      "epoch13, loss 2.071337938308716\n",
      "epoch14, loss 2.048006057739258\n",
      "epoch15, loss 2.0249409675598145\n",
      "epoch16, loss 2.0021347999572754\n",
      "epoch17, loss 1.9795833826065063\n",
      "epoch18, loss 1.9572880268096924\n",
      "epoch19, loss 1.9352413415908813\n",
      "epoch20, loss 1.9134477376937866\n",
      "epoch21, loss 1.8918975591659546\n",
      "epoch22, loss 1.8705898523330688\n",
      "epoch23, loss 1.8495222330093384\n",
      "epoch24, loss 1.828691840171814\n",
      "epoch25, loss 1.8080971240997314\n",
      "epoch26, loss 1.7877315282821655\n",
      "epoch27, loss 1.7675966024398804\n",
      "epoch28, loss 1.7476907968521118\n",
      "epoch29, loss 1.7280069589614868\n",
      "epoch30, loss 1.7085431814193726\n",
      "epoch31, loss 1.6893011331558228\n",
      "epoch32, loss 1.6702756881713867\n",
      "epoch33, loss 1.6514651775360107\n",
      "epoch34, loss 1.6328645944595337\n",
      "epoch35, loss 1.6144756078720093\n",
      "epoch36, loss 1.5962889194488525\n",
      "epoch37, loss 1.5783121585845947\n",
      "epoch38, loss 1.5605378150939941\n",
      "epoch39, loss 1.542960524559021\n",
      "epoch40, loss 1.5255824327468872\n",
      "epoch41, loss 1.5084036588668823\n",
      "epoch42, loss 1.4914124011993408\n",
      "epoch43, loss 1.4746136665344238\n",
      "epoch44, loss 1.458009123802185\n",
      "epoch45, loss 1.4415862560272217\n",
      "epoch46, loss 1.425351619720459\n",
      "epoch47, loss 1.4092974662780762\n",
      "epoch48, loss 1.3934261798858643\n",
      "epoch49, loss 1.3777281045913696\n",
      "epoch50, loss 1.3622138500213623\n",
      "epoch51, loss 1.3468698263168335\n",
      "epoch52, loss 1.3317018747329712\n",
      "epoch53, loss 1.316701889038086\n",
      "epoch54, loss 1.301876187324524\n",
      "epoch55, loss 1.2872105836868286\n",
      "epoch56, loss 1.2727158069610596\n",
      "epoch57, loss 1.258379340171814\n",
      "epoch58, loss 1.2442071437835693\n",
      "epoch59, loss 1.2301924228668213\n",
      "epoch60, loss 1.2163392305374146\n",
      "epoch61, loss 1.2026398181915283\n",
      "epoch62, loss 1.1890939474105835\n",
      "epoch63, loss 1.1757023334503174\n",
      "epoch64, loss 1.1624600887298584\n",
      "epoch65, loss 1.149369716644287\n",
      "epoch66, loss 1.1364223957061768\n",
      "epoch67, loss 1.1236215829849243\n",
      "epoch68, loss 1.1109673976898193\n",
      "epoch69, loss 1.0984567403793335\n",
      "epoch70, loss 1.0860860347747803\n",
      "epoch71, loss 1.0738544464111328\n",
      "epoch72, loss 1.0617611408233643\n",
      "epoch73, loss 1.0498006343841553\n",
      "epoch74, loss 1.0379763841629028\n",
      "epoch75, loss 1.026285171508789\n",
      "epoch76, loss 1.014728307723999\n",
      "epoch77, loss 1.0032989978790283\n",
      "epoch78, loss 0.9919990301132202\n",
      "epoch79, loss 0.9808259010314941\n",
      "epoch80, loss 0.9697806239128113\n",
      "epoch81, loss 0.9588574171066284\n",
      "epoch82, loss 0.9480575323104858\n",
      "epoch83, loss 0.9373798370361328\n",
      "epoch84, loss 0.92682284116745\n",
      "epoch85, loss 0.9163841009140015\n",
      "epoch86, loss 0.906064510345459\n",
      "epoch87, loss 0.8958579301834106\n",
      "epoch88, loss 0.8857678174972534\n",
      "epoch89, loss 0.8757950067520142\n",
      "epoch90, loss 0.8659292459487915\n",
      "epoch91, loss 0.8561758995056152\n",
      "epoch92, loss 0.8465332984924316\n",
      "epoch93, loss 0.8369982838630676\n",
      "epoch94, loss 0.8275742530822754\n",
      "epoch95, loss 0.8182516098022461\n",
      "epoch96, loss 0.8090386390686035\n",
      "epoch97, loss 0.7999248504638672\n",
      "epoch98, loss 0.7909144759178162\n",
      "epoch99, loss 0.7820076942443848\n",
      "epoch100, loss 0.7732006311416626\n",
      "epoch101, loss 0.7644924521446228\n",
      "epoch102, loss 0.7558800578117371\n",
      "epoch103, loss 0.7473680377006531\n",
      "epoch104, loss 0.7389504313468933\n",
      "epoch105, loss 0.730628490447998\n",
      "epoch106, loss 0.7223989367485046\n",
      "epoch107, loss 0.7142642736434937\n",
      "epoch108, loss 0.7062181234359741\n",
      "epoch109, loss 0.6982649564743042\n",
      "epoch110, loss 0.6904011368751526\n",
      "epoch111, loss 0.6826237440109253\n",
      "epoch112, loss 0.6749377846717834\n",
      "epoch113, loss 0.667336106300354\n",
      "epoch114, loss 0.6598207354545593\n",
      "epoch115, loss 0.6523865461349487\n",
      "epoch116, loss 0.6450403928756714\n",
      "epoch117, loss 0.6377745866775513\n",
      "epoch118, loss 0.6305908560752869\n",
      "epoch119, loss 0.623489499092102\n",
      "epoch120, loss 0.6164675951004028\n",
      "epoch121, loss 0.6095259189605713\n",
      "epoch122, loss 0.6026611328125\n",
      "epoch123, loss 0.595873236656189\n",
      "epoch124, loss 0.5891615748405457\n",
      "epoch125, loss 0.5825274586677551\n",
      "epoch126, loss 0.5759629607200623\n",
      "epoch127, loss 0.5694767236709595\n",
      "epoch128, loss 0.5630643963813782\n",
      "epoch129, loss 0.5567242503166199\n",
      "epoch130, loss 0.5504530668258667\n",
      "epoch131, loss 0.5442525744438171\n",
      "epoch132, loss 0.5381245017051697\n",
      "epoch133, loss 0.5320619940757751\n",
      "epoch134, loss 0.526070237159729\n",
      "epoch135, loss 0.5201461911201477\n",
      "epoch136, loss 0.5142877697944641\n",
      "epoch137, loss 0.5084947347640991\n",
      "epoch138, loss 0.5027667284011841\n",
      "epoch139, loss 0.4971047341823578\n",
      "epoch140, loss 0.49150586128234863\n",
      "epoch141, loss 0.4859706461429596\n",
      "epoch142, loss 0.4804975092411041\n",
      "epoch143, loss 0.4750853478908539\n",
      "epoch144, loss 0.46973633766174316\n",
      "epoch145, loss 0.4644443392753601\n",
      "epoch146, loss 0.4592132568359375\n",
      "epoch147, loss 0.45404237508773804\n",
      "epoch148, loss 0.4489270746707916\n",
      "epoch149, loss 0.4438720643520355\n",
      "epoch150, loss 0.4388731122016907\n",
      "epoch151, loss 0.4339292049407959\n",
      "epoch152, loss 0.4290425181388855\n",
      "epoch153, loss 0.4242115914821625\n",
      "epoch154, loss 0.4194319248199463\n",
      "epoch155, loss 0.4147084653377533\n",
      "epoch156, loss 0.4100390076637268\n",
      "epoch157, loss 0.4054202139377594\n",
      "epoch158, loss 0.4008540213108063\n",
      "epoch159, loss 0.3963393568992615\n",
      "epoch160, loss 0.39187535643577576\n",
      "epoch161, loss 0.3874620795249939\n",
      "epoch162, loss 0.38309723138809204\n",
      "epoch163, loss 0.37878352403640747\n",
      "epoch164, loss 0.3745160400867462\n",
      "epoch165, loss 0.3702987730503082\n",
      "epoch166, loss 0.3661282956600189\n",
      "epoch167, loss 0.36200469732284546\n",
      "epoch168, loss 0.35792726278305054\n",
      "epoch169, loss 0.3538955748081207\n",
      "epoch170, loss 0.34991127252578735\n",
      "epoch171, loss 0.3459685444831848\n",
      "epoch172, loss 0.34207332134246826\n",
      "epoch173, loss 0.33821967244148254\n",
      "epoch174, loss 0.334410160779953\n",
      "epoch175, loss 0.3306439518928528\n",
      "epoch176, loss 0.3269203305244446\n",
      "epoch177, loss 0.32323911786079407\n",
      "epoch178, loss 0.31959861516952515\n",
      "epoch179, loss 0.31599918007850647\n",
      "epoch180, loss 0.3124392628669739\n",
      "epoch181, loss 0.30892065167427063\n",
      "epoch182, loss 0.30544188618659973\n",
      "epoch183, loss 0.30200105905532837\n",
      "epoch184, loss 0.29860007762908936\n",
      "epoch185, loss 0.2952377498149872\n",
      "epoch186, loss 0.29191306233406067\n",
      "epoch187, loss 0.2886241376399994\n",
      "epoch188, loss 0.2853735089302063\n",
      "epoch189, loss 0.2821598947048187\n",
      "epoch190, loss 0.27898234128952026\n",
      "epoch191, loss 0.2758404016494751\n",
      "epoch192, loss 0.27273285388946533\n",
      "epoch193, loss 0.26966071128845215\n",
      "epoch194, loss 0.2666243612766266\n",
      "epoch195, loss 0.26362156867980957\n",
      "epoch196, loss 0.26065322756767273\n",
      "epoch197, loss 0.2577177882194519\n",
      "epoch198, loss 0.2548135817050934\n",
      "epoch199, loss 0.25194352865219116\n",
      "epoch200, loss 0.2491064965724945\n",
      "epoch201, loss 0.24630138278007507\n",
      "epoch202, loss 0.24352756142616272\n",
      "epoch203, loss 0.24078369140625\n",
      "epoch204, loss 0.23807203769683838\n",
      "epoch205, loss 0.2353920191526413\n",
      "epoch206, loss 0.23274028301239014\n",
      "epoch207, loss 0.2301185429096222\n",
      "epoch208, loss 0.2275269478559494\n",
      "epoch209, loss 0.22496411204338074\n",
      "epoch210, loss 0.22243015468120575\n",
      "epoch211, loss 0.21992596983909607\n",
      "epoch212, loss 0.21744906902313232\n",
      "epoch213, loss 0.21499958634376526\n",
      "epoch214, loss 0.21257784962654114\n",
      "epoch215, loss 0.21018369495868683\n",
      "epoch216, loss 0.20781664550304413\n",
      "epoch217, loss 0.20547619462013245\n",
      "epoch218, loss 0.20316191017627716\n",
      "epoch219, loss 0.20087361335754395\n",
      "epoch220, loss 0.19861125946044922\n",
      "epoch221, loss 0.19637373089790344\n",
      "epoch222, loss 0.1941622495651245\n",
      "epoch223, loss 0.19197633862495422\n",
      "epoch224, loss 0.18981382250785828\n",
      "epoch225, loss 0.18767604231834412\n",
      "epoch226, loss 0.18556177616119385\n",
      "epoch227, loss 0.18347278237342834\n",
      "epoch228, loss 0.1814054697751999\n",
      "epoch229, loss 0.179362952709198\n",
      "epoch230, loss 0.17734256386756897\n",
      "epoch231, loss 0.17534556984901428\n",
      "epoch232, loss 0.173370823264122\n",
      "epoch233, loss 0.17141784727573395\n",
      "epoch234, loss 0.1694875955581665\n",
      "epoch235, loss 0.16757847368717194\n",
      "epoch236, loss 0.16569103300571442\n",
      "epoch237, loss 0.16382572054862976\n",
      "epoch238, loss 0.16198031604290009\n",
      "epoch239, loss 0.16015507280826569\n",
      "epoch240, loss 0.15835173428058624\n",
      "epoch241, loss 0.156568244099617\n",
      "epoch242, loss 0.1548047661781311\n",
      "epoch243, loss 0.1530621498823166\n",
      "epoch244, loss 0.15133754909038544\n",
      "epoch245, loss 0.1496327519416809\n",
      "epoch246, loss 0.14794819056987762\n",
      "epoch247, loss 0.14628204703330994\n",
      "epoch248, loss 0.14463382959365845\n",
      "epoch249, loss 0.1430055797100067\n",
      "epoch250, loss 0.14139540493488312\n",
      "epoch251, loss 0.13980156183242798\n",
      "epoch252, loss 0.13822771608829498\n",
      "epoch253, loss 0.13667087256908417\n",
      "epoch254, loss 0.13513226807117462\n",
      "epoch255, loss 0.13360892236232758\n",
      "epoch256, loss 0.13210518658161163\n",
      "epoch257, loss 0.13061752915382385\n",
      "epoch258, loss 0.12914520502090454\n",
      "epoch259, loss 0.1276915967464447\n",
      "epoch260, loss 0.12625250220298767\n",
      "epoch261, loss 0.12483177334070206\n",
      "epoch262, loss 0.12342588603496552\n",
      "epoch263, loss 0.12203498929738998\n",
      "epoch264, loss 0.12066087871789932\n",
      "epoch265, loss 0.11930221319198608\n",
      "epoch266, loss 0.11795755475759506\n",
      "epoch267, loss 0.11662907898426056\n",
      "epoch268, loss 0.11531593650579453\n",
      "epoch269, loss 0.11401780694723129\n",
      "epoch270, loss 0.1127329096198082\n",
      "epoch271, loss 0.11146333068609238\n",
      "epoch272, loss 0.11020798981189728\n",
      "epoch273, loss 0.10896673053503036\n",
      "epoch274, loss 0.10773973166942596\n",
      "epoch275, loss 0.10652661323547363\n",
      "epoch276, loss 0.10532672703266144\n",
      "epoch277, loss 0.10414072126150131\n",
      "epoch278, loss 0.10296642780303955\n",
      "epoch279, loss 0.1018073558807373\n",
      "epoch280, loss 0.10066107660531998\n",
      "epoch281, loss 0.09952783584594727\n",
      "epoch282, loss 0.09840669482946396\n",
      "epoch283, loss 0.09729792177677155\n",
      "epoch284, loss 0.09620192646980286\n",
      "epoch285, loss 0.09511824697256088\n",
      "epoch286, loss 0.09404797106981277\n",
      "epoch287, loss 0.0929882675409317\n",
      "epoch288, loss 0.09194052964448929\n",
      "epoch289, loss 0.09090556204319\n",
      "epoch290, loss 0.0898812785744667\n",
      "epoch291, loss 0.088868647813797\n",
      "epoch292, loss 0.0878681093454361\n",
      "epoch293, loss 0.08687829971313477\n",
      "epoch294, loss 0.0859004333615303\n",
      "epoch295, loss 0.08493292331695557\n",
      "epoch296, loss 0.08397577702999115\n",
      "epoch297, loss 0.08303004503250122\n",
      "epoch298, loss 0.0820954442024231\n",
      "epoch299, loss 0.08117067813873291\n",
      "epoch300, loss 0.08025692403316498\n",
      "epoch301, loss 0.07935191690921783\n",
      "epoch302, loss 0.07845818996429443\n",
      "epoch303, loss 0.0775754451751709\n",
      "epoch304, loss 0.07670141011476517\n",
      "epoch305, loss 0.07583735883235931\n",
      "epoch306, loss 0.07498367130756378\n",
      "epoch307, loss 0.07413895428180695\n",
      "epoch308, loss 0.07330393046140671\n",
      "epoch309, loss 0.07247816771268845\n",
      "epoch310, loss 0.07166242599487305\n",
      "epoch311, loss 0.0708545595407486\n",
      "epoch312, loss 0.07005719095468521\n",
      "epoch313, loss 0.06926850974559784\n",
      "epoch314, loss 0.06848815828561783\n",
      "epoch315, loss 0.06771685183048248\n",
      "epoch316, loss 0.06695424020290375\n",
      "epoch317, loss 0.06619994342327118\n",
      "epoch318, loss 0.06545409560203552\n",
      "epoch319, loss 0.06471650302410126\n",
      "epoch320, loss 0.06398805230855942\n",
      "epoch321, loss 0.06326721608638763\n",
      "epoch322, loss 0.06255465745925903\n",
      "epoch323, loss 0.06185020133852959\n",
      "epoch324, loss 0.061153680086135864\n",
      "epoch325, loss 0.0604654923081398\n",
      "epoch326, loss 0.05978423357009888\n",
      "epoch327, loss 0.05911089852452278\n",
      "epoch328, loss 0.058444857597351074\n",
      "epoch329, loss 0.057786814868450165\n",
      "epoch330, loss 0.05713589861989021\n",
      "epoch331, loss 0.05649251863360405\n",
      "epoch332, loss 0.055856265127658844\n",
      "epoch333, loss 0.05522694066166878\n",
      "epoch334, loss 0.05460522696375847\n",
      "epoch335, loss 0.053989898413419724\n",
      "epoch336, loss 0.05338181182742119\n",
      "epoch337, loss 0.052780698984861374\n",
      "epoch338, loss 0.05218604952096939\n",
      "epoch339, loss 0.05159845948219299\n",
      "epoch340, loss 0.05101781338453293\n",
      "epoch341, loss 0.05044270306825638\n",
      "epoch342, loss 0.04987455531954765\n",
      "epoch343, loss 0.04931282997131348\n",
      "epoch344, loss 0.048757556825876236\n",
      "epoch345, loss 0.04820837453007698\n",
      "epoch346, loss 0.047665249556303024\n",
      "epoch347, loss 0.04712868481874466\n",
      "epoch348, loss 0.0465976819396019\n",
      "epoch349, loss 0.04607345163822174\n",
      "epoch350, loss 0.045554179698228836\n",
      "epoch351, loss 0.04504098743200302\n",
      "epoch352, loss 0.04453356936573982\n",
      "epoch353, loss 0.044032029807567596\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch354, loss 0.043535977602005005\n",
      "epoch355, loss 0.04304575175046921\n",
      "epoch356, loss 0.042561449110507965\n",
      "epoch357, loss 0.042081937193870544\n",
      "epoch358, loss 0.0416080541908741\n",
      "epoch359, loss 0.04113950580358505\n",
      "epoch360, loss 0.0406755767762661\n",
      "epoch361, loss 0.04021746292710304\n",
      "epoch362, loss 0.03976476937532425\n",
      "epoch363, loss 0.03931685537099838\n",
      "epoch364, loss 0.03887444734573364\n",
      "epoch365, loss 0.03843638673424721\n",
      "epoch366, loss 0.038003306835889816\n",
      "epoch367, loss 0.037575192749500275\n",
      "epoch368, loss 0.03715246543288231\n",
      "epoch369, loss 0.03673390671610832\n",
      "epoch370, loss 0.03631993383169174\n",
      "epoch371, loss 0.0359109602868557\n",
      "epoch372, loss 0.03550652787089348\n",
      "epoch373, loss 0.03510676696896553\n",
      "epoch374, loss 0.03471148759126663\n",
      "epoch375, loss 0.034320391714572906\n",
      "epoch376, loss 0.033933576196432114\n",
      "epoch377, loss 0.033551476895809174\n",
      "epoch378, loss 0.03317379951477051\n",
      "epoch379, loss 0.03280008211731911\n",
      "epoch380, loss 0.03243062645196915\n",
      "epoch381, loss 0.0320655032992363\n",
      "epoch382, loss 0.031704045832157135\n",
      "epoch383, loss 0.03134700655937195\n",
      "epoch384, loss 0.030994072556495667\n",
      "epoch385, loss 0.030644899234175682\n",
      "epoch386, loss 0.030299842357635498\n",
      "epoch387, loss 0.02995852194726467\n",
      "epoch388, loss 0.02962106466293335\n",
      "epoch389, loss 0.029287755489349365\n",
      "epoch390, loss 0.028958190232515335\n",
      "epoch391, loss 0.028631681576371193\n",
      "epoch392, loss 0.028308982029557228\n",
      "epoch393, loss 0.02799057587981224\n",
      "epoch394, loss 0.027675023302435875\n",
      "epoch395, loss 0.027363285422325134\n",
      "epoch396, loss 0.027055148035287857\n",
      "epoch397, loss 0.026750411838293076\n",
      "epoch398, loss 0.026449372991919518\n",
      "epoch399, loss 0.026150893419981003\n",
      "epoch400, loss 0.02585676871240139\n",
      "epoch401, loss 0.025565380230545998\n",
      "epoch402, loss 0.025277409702539444\n",
      "epoch403, loss 0.024993179365992546\n",
      "epoch404, loss 0.024711307138204575\n",
      "epoch405, loss 0.024432841688394547\n",
      "epoch406, loss 0.02415795996785164\n",
      "epoch407, loss 0.02388579212129116\n",
      "epoch408, loss 0.02361673302948475\n",
      "epoch409, loss 0.023350941017270088\n",
      "epoch410, loss 0.02308778092265129\n",
      "epoch411, loss 0.02282751351594925\n",
      "epoch412, loss 0.02257048524916172\n",
      "epoch413, loss 0.022316670045256615\n",
      "epoch414, loss 0.0220648180693388\n",
      "epoch415, loss 0.02181675285100937\n",
      "epoch416, loss 0.021570738404989243\n",
      "epoch417, loss 0.02132776565849781\n",
      "epoch418, loss 0.021087706089019775\n",
      "epoch419, loss 0.020850542932748795\n",
      "epoch420, loss 0.020615437999367714\n",
      "epoch421, loss 0.02038329467177391\n",
      "epoch422, loss 0.020153827965259552\n",
      "epoch423, loss 0.01992650330066681\n",
      "epoch424, loss 0.01970246434211731\n",
      "epoch425, loss 0.019480442628264427\n",
      "epoch426, loss 0.019260885193943977\n",
      "epoch427, loss 0.019044090062379837\n",
      "epoch428, loss 0.018829332664608955\n",
      "epoch429, loss 0.018617741763591766\n",
      "epoch430, loss 0.018407966941595078\n",
      "epoch431, loss 0.018200527876615524\n",
      "epoch432, loss 0.017995741218328476\n",
      "epoch433, loss 0.01779281720519066\n",
      "epoch434, loss 0.017592662945389748\n",
      "epoch435, loss 0.017394401133060455\n",
      "epoch436, loss 0.01719864271581173\n",
      "epoch437, loss 0.017004672437906265\n",
      "epoch438, loss 0.016813278198242188\n",
      "epoch439, loss 0.01662389189004898\n",
      "epoch440, loss 0.016436684876680374\n",
      "epoch441, loss 0.016251560300588608\n",
      "epoch442, loss 0.016068320721387863\n",
      "epoch443, loss 0.015887504443526268\n",
      "epoch444, loss 0.015708480030298233\n",
      "epoch445, loss 0.015531343407928944\n",
      "epoch446, loss 0.015356479212641716\n",
      "epoch447, loss 0.015183458104729652\n",
      "epoch448, loss 0.01501266099512577\n",
      "epoch449, loss 0.014843503944575787\n",
      "epoch450, loss 0.014676417224109173\n",
      "epoch451, loss 0.014511358924210072\n",
      "epoch452, loss 0.014347434043884277\n",
      "epoch453, loss 0.014186154119670391\n",
      "epoch454, loss 0.014026416465640068\n",
      "epoch455, loss 0.013868296518921852\n",
      "epoch456, loss 0.01371215283870697\n",
      "epoch457, loss 0.013557717204093933\n",
      "epoch458, loss 0.013405054807662964\n",
      "epoch459, loss 0.013254011981189251\n",
      "epoch460, loss 0.013105006888508797\n",
      "epoch461, loss 0.012957200407981873\n",
      "epoch462, loss 0.01281137578189373\n",
      "epoch463, loss 0.01266683079302311\n",
      "epoch464, loss 0.012524308636784554\n",
      "epoch465, loss 0.012383293360471725\n",
      "epoch466, loss 0.012243758887052536\n",
      "epoch467, loss 0.012106134556233883\n",
      "epoch468, loss 0.011969400569796562\n",
      "epoch469, loss 0.011834582313895226\n",
      "epoch470, loss 0.011701507493853569\n",
      "epoch471, loss 0.01156981848180294\n",
      "epoch472, loss 0.011439332738518715\n",
      "epoch473, loss 0.011310497298836708\n",
      "epoch474, loss 0.01118310447782278\n",
      "epoch475, loss 0.011057130061089993\n",
      "epoch476, loss 0.010932576842606068\n",
      "epoch477, loss 0.010809414088726044\n",
      "epoch478, loss 0.010687890462577343\n",
      "epoch479, loss 0.010567504912614822\n",
      "epoch480, loss 0.010448450222611427\n",
      "epoch481, loss 0.010330641642212868\n",
      "epoch482, loss 0.010214457288384438\n",
      "epoch483, loss 0.010099349543452263\n",
      "epoch484, loss 0.00998549722135067\n",
      "epoch485, loss 0.009872938506305218\n",
      "epoch486, loss 0.009762105531990528\n",
      "epoch487, loss 0.009652219712734222\n",
      "epoch488, loss 0.009543204680085182\n",
      "epoch489, loss 0.009435724467039108\n",
      "epoch490, loss 0.009329572319984436\n",
      "epoch491, loss 0.0092246038839221\n",
      "epoch492, loss 0.00912061333656311\n",
      "epoch493, loss 0.009017856791615486\n",
      "epoch494, loss 0.008916381746530533\n",
      "epoch495, loss 0.008816014975309372\n",
      "epoch496, loss 0.008716559037566185\n",
      "epoch497, loss 0.00861828587949276\n",
      "epoch498, loss 0.008521122857928276\n",
      "epoch499, loss 0.008425222709774971\n",
      "epoch500, loss 0.008330506272614002\n",
      "epoch501, loss 0.008236721158027649\n",
      "epoch502, loss 0.008143763989210129\n",
      "epoch503, loss 0.00805207435041666\n",
      "epoch504, loss 0.007961591705679893\n",
      "epoch505, loss 0.007871674373745918\n",
      "epoch506, loss 0.007782972417771816\n",
      "epoch507, loss 0.007695591542869806\n",
      "epoch508, loss 0.007608689367771149\n",
      "epoch509, loss 0.007522988133132458\n",
      "epoch510, loss 0.007438532076776028\n",
      "epoch511, loss 0.007354501634836197\n",
      "epoch512, loss 0.00727169681340456\n",
      "epoch513, loss 0.007189900614321232\n",
      "epoch514, loss 0.007108859717845917\n",
      "epoch515, loss 0.007028772030025721\n",
      "epoch516, loss 0.006949814967811108\n",
      "epoch517, loss 0.006871391087770462\n",
      "epoch518, loss 0.006793857552111149\n",
      "epoch519, loss 0.006717492826282978\n",
      "epoch520, loss 0.006641679909080267\n",
      "epoch521, loss 0.006566987372934818\n",
      "epoch522, loss 0.006493094377219677\n",
      "epoch523, loss 0.006419801618903875\n",
      "epoch524, loss 0.006347773130983114\n",
      "epoch525, loss 0.006276066415011883\n",
      "epoch526, loss 0.006205483339726925\n",
      "epoch527, loss 0.00613548094406724\n",
      "epoch528, loss 0.006066381931304932\n",
      "epoch529, loss 0.005997983738780022\n",
      "epoch530, loss 0.0059305946342647076\n",
      "epoch531, loss 0.005863814614713192\n",
      "epoch532, loss 0.0057976385578513145\n",
      "epoch533, loss 0.005732391029596329\n",
      "epoch534, loss 0.005667922552675009\n",
      "epoch535, loss 0.005604120437055826\n",
      "epoch536, loss 0.0055408296175301075\n",
      "epoch537, loss 0.005478538107126951\n",
      "epoch538, loss 0.005416831932961941\n",
      "epoch539, loss 0.005355908535420895\n",
      "epoch540, loss 0.00529543636366725\n",
      "epoch541, loss 0.0052358186803758144\n",
      "epoch542, loss 0.005176937207579613\n",
      "epoch543, loss 0.005118434317409992\n",
      "epoch544, loss 0.005060948897153139\n",
      "epoch545, loss 0.005003945901989937\n",
      "epoch546, loss 0.0049475510604679585\n",
      "epoch547, loss 0.004891835618764162\n",
      "epoch548, loss 0.004836686421185732\n",
      "epoch549, loss 0.0047824326902627945\n",
      "epoch550, loss 0.004728362429887056\n",
      "epoch551, loss 0.004675096832215786\n",
      "epoch552, loss 0.0046223802492022514\n",
      "epoch553, loss 0.004570400342345238\n",
      "epoch554, loss 0.004518954548984766\n",
      "epoch555, loss 0.004468080122023821\n",
      "epoch556, loss 0.004417694639414549\n",
      "epoch557, loss 0.004368063993752003\n",
      "epoch558, loss 0.004318826831877232\n",
      "epoch559, loss 0.004270133096724749\n",
      "epoch560, loss 0.004222049377858639\n",
      "epoch561, loss 0.004174454137682915\n",
      "epoch562, loss 0.004127499647438526\n",
      "epoch563, loss 0.004081045743077993\n",
      "epoch564, loss 0.004034906160086393\n",
      "epoch565, loss 0.003989492543041706\n",
      "epoch566, loss 0.003944774623960257\n",
      "epoch567, loss 0.003900306299328804\n",
      "epoch568, loss 0.0038563325069844723\n",
      "epoch569, loss 0.0038128108717501163\n",
      "epoch570, loss 0.003769911825656891\n",
      "epoch571, loss 0.0037273583002388477\n",
      "epoch572, loss 0.0036854050122201443\n",
      "epoch573, loss 0.0036439113318920135\n",
      "epoch574, loss 0.003602913348004222\n",
      "epoch575, loss 0.003562411293387413\n",
      "epoch576, loss 0.0035223246086388826\n",
      "epoch577, loss 0.003482720348984003\n",
      "epoch578, loss 0.003443323541432619\n",
      "epoch579, loss 0.0034046671353280544\n",
      "epoch580, loss 0.00336627964861691\n",
      "epoch581, loss 0.0033283133525401354\n",
      "epoch582, loss 0.003290868131443858\n",
      "epoch583, loss 0.0032538094092160463\n",
      "epoch584, loss 0.0032171409111469984\n",
      "epoch585, loss 0.003180908737704158\n",
      "epoch586, loss 0.0031450972892344\n",
      "epoch587, loss 0.00310964765958488\n",
      "epoch588, loss 0.0030745952390134335\n",
      "epoch589, loss 0.003040049225091934\n",
      "epoch590, loss 0.003005699021741748\n",
      "epoch591, loss 0.0029717497527599335\n",
      "epoch592, loss 0.002938432153314352\n",
      "epoch593, loss 0.002905233297497034\n",
      "epoch594, loss 0.0028726111631840467\n",
      "epoch595, loss 0.002840174827724695\n",
      "epoch596, loss 0.002808318007737398\n",
      "epoch597, loss 0.002776648383587599\n",
      "epoch598, loss 0.002745423000305891\n",
      "epoch599, loss 0.0027144812047481537\n",
      "epoch600, loss 0.0026837948244065046\n",
      "epoch601, loss 0.0026536262594163418\n",
      "epoch602, loss 0.0026237047277390957\n",
      "epoch603, loss 0.0025942169595509768\n",
      "epoch604, loss 0.0025649922899901867\n",
      "epoch605, loss 0.0025361415464431047\n",
      "epoch606, loss 0.0025075110606849194\n",
      "epoch607, loss 0.0024792784824967384\n",
      "epoch608, loss 0.0024513897951692343\n",
      "epoch609, loss 0.002423808677121997\n",
      "epoch610, loss 0.0023964555002748966\n",
      "epoch611, loss 0.0023694299161434174\n",
      "epoch612, loss 0.0023427444975823164\n",
      "epoch613, loss 0.0023163005243986845\n",
      "epoch614, loss 0.0022902723867446184\n",
      "epoch615, loss 0.002264490118250251\n",
      "epoch616, loss 0.0022390352096408606\n",
      "epoch617, loss 0.0022138908971101046\n",
      "epoch618, loss 0.0021888469345867634\n",
      "epoch619, loss 0.0021642011124640703\n",
      "epoch620, loss 0.0021398719400167465\n",
      "epoch621, loss 0.0021156896837055683\n",
      "epoch622, loss 0.0020919719245284796\n",
      "epoch623, loss 0.0020683365873992443\n",
      "epoch624, loss 0.0020450358279049397\n",
      "epoch625, loss 0.0020219641737639904\n",
      "epoch626, loss 0.001999247819185257\n",
      "epoch627, loss 0.0019767056219279766\n",
      "epoch628, loss 0.001954459585249424\n",
      "epoch629, loss 0.0019324005115777254\n",
      "epoch630, loss 0.0019106706604361534\n",
      "epoch631, loss 0.001889189938083291\n",
      "epoch632, loss 0.0018678618362173438\n",
      "epoch633, loss 0.001846828730776906\n",
      "epoch634, loss 0.0018261052900925279\n",
      "epoch635, loss 0.0018054803367704153\n",
      "epoch636, loss 0.0017851326847448945\n",
      "epoch637, loss 0.0017649910878390074\n",
      "epoch638, loss 0.0017451327294111252\n",
      "epoch639, loss 0.001725492300465703\n",
      "epoch640, loss 0.0017060093814507127\n",
      "epoch641, loss 0.0016869071405380964\n",
      "epoch642, loss 0.0016679049003869295\n",
      "epoch643, loss 0.0016490431735292077\n",
      "epoch644, loss 0.0016305071767419577\n",
      "epoch645, loss 0.0016121864318847656\n",
      "epoch646, loss 0.0015939449658617377\n",
      "epoch647, loss 0.0015760501846671104\n",
      "epoch648, loss 0.0015582223422825336\n",
      "epoch649, loss 0.0015406382735818624\n",
      "epoch650, loss 0.00152333895675838\n",
      "epoch651, loss 0.0015061708400025964\n",
      "epoch652, loss 0.001489224610850215\n",
      "epoch653, loss 0.0014724303036928177\n",
      "epoch654, loss 0.001455903984606266\n",
      "epoch655, loss 0.001439466723240912\n",
      "epoch656, loss 0.0014232051325961947\n",
      "epoch657, loss 0.0014072181656956673\n",
      "epoch658, loss 0.0013913956936448812\n",
      "epoch659, loss 0.0013758111745119095\n",
      "epoch660, loss 0.001360229216516018\n",
      "epoch661, loss 0.001344884978607297\n",
      "epoch662, loss 0.001329807797446847\n",
      "epoch663, loss 0.0013148487778380513\n",
      "epoch664, loss 0.001300012692809105\n",
      "epoch665, loss 0.0012852883664891124\n",
      "epoch666, loss 0.0012708763824775815\n",
      "epoch667, loss 0.0012565378565341234\n",
      "epoch668, loss 0.0012424507876858115\n",
      "epoch669, loss 0.0012284209951758385\n",
      "epoch670, loss 0.0012145627988502383\n",
      "epoch671, loss 0.0012009225320070982\n",
      "epoch672, loss 0.0011873409384861588\n",
      "epoch673, loss 0.001174044911749661\n",
      "epoch674, loss 0.0011607417836785316\n",
      "epoch675, loss 0.0011477067600935698\n",
      "epoch676, loss 0.0011347457766532898\n",
      "epoch677, loss 0.001121984445489943\n",
      "epoch678, loss 0.0011093039065599442\n",
      "epoch679, loss 0.0010968714486807585\n",
      "epoch680, loss 0.0010845449287444353\n",
      "epoch681, loss 0.0010723338928073645\n",
      "epoch682, loss 0.0010601883986964822\n",
      "epoch683, loss 0.001048263511620462\n",
      "epoch684, loss 0.0010364777408540249\n",
      "epoch685, loss 0.001024804194457829\n",
      "epoch686, loss 0.0010132581228390336\n",
      "epoch687, loss 0.0010018546599894762\n",
      "epoch688, loss 0.000990597764030099\n",
      "epoch689, loss 0.000979335280135274\n",
      "epoch690, loss 0.00096838956233114\n",
      "epoch691, loss 0.0009574584546498954\n",
      "epoch692, loss 0.0009467208874411881\n",
      "epoch693, loss 0.0009360536932945251\n",
      "epoch694, loss 0.0009255207260139287\n",
      "epoch695, loss 0.000915076001547277\n",
      "epoch696, loss 0.0009048201027326286\n",
      "epoch697, loss 0.0008945678127929568\n",
      "epoch698, loss 0.0008845360134728253\n",
      "epoch699, loss 0.000874496647156775\n",
      "epoch700, loss 0.0008646685746498406\n",
      "epoch701, loss 0.0008549752528779209\n",
      "epoch702, loss 0.0008452920010313392\n",
      "epoch703, loss 0.0008358120103366673\n",
      "epoch704, loss 0.0008264003554359078\n",
      "epoch705, loss 0.000817101274151355\n",
      "epoch706, loss 0.0008078743703663349\n",
      "epoch707, loss 0.0007987722638063133\n",
      "epoch708, loss 0.0007897338946349919\n",
      "epoch709, loss 0.0007809125236235559\n",
      "epoch710, loss 0.0007720959256403148\n",
      "epoch711, loss 0.0007634054054506123\n",
      "epoch712, loss 0.0007547716377303004\n",
      "epoch713, loss 0.0007462924113497138\n",
      "epoch714, loss 0.0007378669688478112\n",
      "epoch715, loss 0.0007295720279216766\n",
      "epoch716, loss 0.0007213660283014178\n",
      "epoch717, loss 0.0007132107275538146\n",
      "epoch718, loss 0.0007052009459584951\n",
      "epoch719, loss 0.0006972629344090819\n",
      "epoch720, loss 0.0006893727695569396\n",
      "epoch721, loss 0.0006815910455770791\n",
      "epoch722, loss 0.0006739315576851368\n",
      "epoch723, loss 0.0006663833628408611\n",
      "epoch724, loss 0.0006588705000467598\n",
      "epoch725, loss 0.0006514185224659741\n",
      "epoch726, loss 0.0006440852885134518\n",
      "epoch727, loss 0.0006368414033204317\n",
      "epoch728, loss 0.0006296869250945747\n",
      "epoch729, loss 0.0006226127734407783\n",
      "epoch730, loss 0.0006155588780529797\n",
      "epoch731, loss 0.0006086599314585328\n",
      "epoch732, loss 0.0006017897394485772\n",
      "epoch733, loss 0.0005949866026639938\n",
      "epoch734, loss 0.0005882912082597613\n",
      "epoch735, loss 0.000581727537792176\n",
      "epoch736, loss 0.0005750870332121849\n",
      "epoch737, loss 0.0005686876247636974\n",
      "epoch738, loss 0.0005622355383820832\n",
      "epoch739, loss 0.0005558665725402534\n",
      "epoch740, loss 0.0005496660014614463\n",
      "epoch741, loss 0.0005434442427940667\n",
      "epoch742, loss 0.0005373613093979657\n",
      "epoch743, loss 0.000531291589140892\n",
      "epoch744, loss 0.000525367446243763\n",
      "epoch745, loss 0.0005193959223106503\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch746, loss 0.0005135274259373546\n",
      "epoch747, loss 0.0005078008398413658\n",
      "epoch748, loss 0.0005020627286285162\n",
      "epoch749, loss 0.0004963591927662492\n",
      "epoch750, loss 0.000490815204102546\n",
      "epoch751, loss 0.00048528407933190465\n",
      "epoch752, loss 0.00047979067312553525\n",
      "epoch753, loss 0.0004744085599668324\n",
      "epoch754, loss 0.0004690508358180523\n",
      "epoch755, loss 0.00046374864177778363\n",
      "epoch756, loss 0.0004585309943649918\n",
      "epoch757, loss 0.00045337239862419665\n",
      "epoch758, loss 0.00044826706289313734\n",
      "epoch759, loss 0.00044321484165266156\n",
      "epoch760, loss 0.0004382224869914353\n",
      "epoch761, loss 0.00043332792120054364\n",
      "epoch762, loss 0.00042842357652261853\n",
      "epoch763, loss 0.00042359111830592155\n",
      "epoch764, loss 0.00041882190271280706\n",
      "epoch765, loss 0.0004141363315284252\n",
      "epoch766, loss 0.00040947383968159556\n",
      "epoch767, loss 0.00040478803566657007\n",
      "epoch768, loss 0.000400287943193689\n",
      "epoch769, loss 0.0003957495209760964\n",
      "epoch770, loss 0.00039132367237471044\n",
      "epoch771, loss 0.0003869089123327285\n",
      "epoch772, loss 0.00038255221443250775\n",
      "epoch773, loss 0.000378234515665099\n",
      "epoch774, loss 0.0003739979292731732\n",
      "epoch775, loss 0.0003697922802530229\n",
      "epoch776, loss 0.0003655691398307681\n",
      "epoch777, loss 0.0003614635788835585\n",
      "epoch778, loss 0.0003574071160983294\n",
      "epoch779, loss 0.0003533536219038069\n",
      "epoch780, loss 0.00034939724719151855\n",
      "epoch781, loss 0.0003454569377936423\n",
      "epoch782, loss 0.00034158927155658603\n",
      "epoch783, loss 0.00033772827009670436\n",
      "epoch784, loss 0.00033389375312253833\n",
      "epoch785, loss 0.000330154289258644\n",
      "epoch786, loss 0.00032641278812661767\n",
      "epoch787, loss 0.00032277326681651175\n",
      "epoch788, loss 0.00031912297708913684\n",
      "epoch789, loss 0.00031558534828945994\n",
      "epoch790, loss 0.00031200904049910605\n",
      "epoch791, loss 0.00030846724985167384\n",
      "epoch792, loss 0.00030502057052217424\n",
      "epoch793, loss 0.0003015603870153427\n",
      "epoch794, loss 0.0002981587895192206\n",
      "epoch795, loss 0.00029485306004062295\n",
      "epoch796, loss 0.00029150419868528843\n",
      "epoch797, loss 0.00028819747967645526\n",
      "epoch798, loss 0.00028497743187472224\n",
      "epoch799, loss 0.0002817590138874948\n",
      "epoch800, loss 0.000278578168945387\n",
      "epoch801, loss 0.00027543719625100493\n",
      "epoch802, loss 0.0002723339421208948\n",
      "epoch803, loss 0.00026925845304504037\n",
      "epoch804, loss 0.00026623671874403954\n",
      "epoch805, loss 0.0002632565447129309\n",
      "epoch806, loss 0.00026027168496511877\n",
      "epoch807, loss 0.00025734276277944446\n",
      "epoch808, loss 0.0002544152666814625\n",
      "epoch809, loss 0.00025157674099318683\n",
      "epoch810, loss 0.0002487523015588522\n",
      "epoch811, loss 0.0002459572860971093\n",
      "epoch812, loss 0.00024319079238921404\n",
      "epoch813, loss 0.000240435911109671\n",
      "epoch814, loss 0.00023773642897140235\n",
      "epoch815, loss 0.00023504343698732555\n",
      "epoch816, loss 0.00023239862639456987\n",
      "epoch817, loss 0.000229813318583183\n",
      "epoch818, loss 0.00022719411936122924\n",
      "epoch819, loss 0.00022465878282673657\n",
      "epoch820, loss 0.00022213420015759766\n",
      "epoch821, loss 0.00021959708828944713\n",
      "epoch822, loss 0.00021715075126849115\n",
      "epoch823, loss 0.00021466081670951098\n",
      "epoch824, loss 0.00021229575213510543\n",
      "epoch825, loss 0.0002098924305755645\n",
      "epoch826, loss 0.0002075237425742671\n",
      "epoch827, loss 0.00020516198128461838\n",
      "epoch828, loss 0.00020286699873395264\n",
      "epoch829, loss 0.00020058636437170208\n",
      "epoch830, loss 0.00019833708938676864\n",
      "epoch831, loss 0.0001960767840500921\n",
      "epoch832, loss 0.00019389615044929087\n",
      "epoch833, loss 0.00019169595907442272\n",
      "epoch834, loss 0.00018954076222144067\n",
      "epoch835, loss 0.00018740864470601082\n",
      "epoch836, loss 0.0001853073190432042\n",
      "epoch837, loss 0.00018318623187951744\n",
      "epoch838, loss 0.00018117111176252365\n",
      "epoch839, loss 0.00017910364840645343\n",
      "epoch840, loss 0.0001770628587109968\n",
      "epoch841, loss 0.00017509028839413077\n",
      "epoch842, loss 0.00017310045950580388\n",
      "epoch843, loss 0.00017119038966484368\n",
      "epoch844, loss 0.00016926640819292516\n",
      "epoch845, loss 0.0001673213264439255\n",
      "epoch846, loss 0.00016546310507692397\n",
      "epoch847, loss 0.0001635913795325905\n",
      "epoch848, loss 0.00016176444478332996\n",
      "epoch849, loss 0.0001599521201569587\n",
      "epoch850, loss 0.0001581244869157672\n",
      "epoch851, loss 0.0001563348778290674\n",
      "epoch852, loss 0.00015460664872080088\n",
      "epoch853, loss 0.00015283635002560914\n",
      "epoch854, loss 0.0001511384325567633\n",
      "epoch855, loss 0.00014940256369300187\n",
      "epoch856, loss 0.0001477500918554142\n",
      "epoch857, loss 0.00014607615594286472\n",
      "epoch858, loss 0.0001444352528778836\n",
      "epoch859, loss 0.00014281203038990498\n",
      "epoch860, loss 0.00014119459956418723\n",
      "epoch861, loss 0.00013961902004666626\n",
      "epoch862, loss 0.00013804668560624123\n",
      "epoch863, loss 0.00013647325977217406\n",
      "epoch864, loss 0.00013493781443685293\n",
      "epoch865, loss 0.00013340085570234805\n",
      "epoch866, loss 0.00013190352183301002\n",
      "epoch867, loss 0.00013044146180618554\n",
      "epoch868, loss 0.00012897371198050678\n",
      "epoch869, loss 0.00012751668691635132\n",
      "epoch870, loss 0.00012606913514900953\n",
      "epoch871, loss 0.00012463617895264179\n",
      "epoch872, loss 0.00012327074364293367\n",
      "epoch873, loss 0.0001218691686517559\n",
      "epoch874, loss 0.00012050147779518738\n",
      "epoch875, loss 0.00011913878552149981\n",
      "epoch876, loss 0.00011777342297136784\n",
      "epoch877, loss 0.00011648880172288045\n",
      "epoch878, loss 0.00011516162339830771\n",
      "epoch879, loss 0.00011384196113795042\n",
      "epoch880, loss 0.00011259161692578346\n",
      "epoch881, loss 0.00011131465726066381\n",
      "epoch882, loss 0.00011004922271240503\n",
      "epoch883, loss 0.00010883474897127599\n",
      "epoch884, loss 0.0001075958862202242\n",
      "epoch885, loss 0.00010638807725626975\n",
      "epoch886, loss 0.00010518974158912897\n",
      "epoch887, loss 0.0001039993148879148\n",
      "epoch888, loss 0.00010281541472068056\n",
      "epoch889, loss 0.00010166796710109338\n",
      "epoch890, loss 0.00010052022844320163\n",
      "epoch891, loss 9.94056899799034e-05\n",
      "epoch892, loss 9.825809684116393e-05\n",
      "epoch893, loss 9.715231135487556e-05\n",
      "epoch894, loss 9.605706873117015e-05\n",
      "epoch895, loss 9.498752478975803e-05\n",
      "epoch896, loss 9.391666390001774e-05\n",
      "epoch897, loss 9.286590648116544e-05\n",
      "epoch898, loss 9.180732013192028e-05\n",
      "epoch899, loss 9.079783922061324e-05\n",
      "epoch900, loss 8.974729280453175e-05\n",
      "epoch901, loss 8.875048661138862e-05\n",
      "epoch902, loss 8.773035369813442e-05\n",
      "epoch903, loss 8.676311699673533e-05\n",
      "epoch904, loss 8.57733393786475e-05\n",
      "epoch905, loss 8.481514669256285e-05\n",
      "epoch906, loss 8.386896661249921e-05\n",
      "epoch907, loss 8.291824633488432e-05\n",
      "epoch908, loss 8.197815623134375e-05\n",
      "epoch909, loss 8.104882726911455e-05\n",
      "epoch910, loss 8.015202183742076e-05\n",
      "epoch911, loss 7.925314275780693e-05\n",
      "epoch912, loss 7.835061114747077e-05\n",
      "epoch913, loss 7.746091432636604e-05\n",
      "epoch914, loss 7.659297261852771e-05\n",
      "epoch915, loss 7.573860784759745e-05\n",
      "epoch916, loss 7.488348637707531e-05\n",
      "epoch917, loss 7.403243944281712e-05\n",
      "epoch918, loss 7.320735312532634e-05\n",
      "epoch919, loss 7.238243415486068e-05\n",
      "epoch920, loss 7.156542415032163e-05\n",
      "epoch921, loss 7.076188194332644e-05\n",
      "epoch922, loss 6.996199226705357e-05\n",
      "epoch923, loss 6.918293365743011e-05\n",
      "epoch924, loss 6.840449350420386e-05\n",
      "epoch925, loss 6.760638643754646e-05\n",
      "epoch926, loss 6.684257823508233e-05\n",
      "epoch927, loss 6.610793207073584e-05\n",
      "epoch928, loss 6.535713328048587e-05\n",
      "epoch929, loss 6.461952580139041e-05\n",
      "epoch930, loss 6.388720066752285e-05\n",
      "epoch931, loss 6.31727889413014e-05\n",
      "epoch932, loss 6.246648990781978e-05\n",
      "epoch933, loss 6.177546310937032e-05\n",
      "epoch934, loss 6.106081127654761e-05\n",
      "epoch935, loss 6.0384732933016494e-05\n",
      "epoch936, loss 5.970120400888845e-05\n",
      "epoch937, loss 5.9030706324847415e-05\n",
      "epoch938, loss 5.836454874952324e-05\n",
      "epoch939, loss 5.770623101852834e-05\n",
      "epoch940, loss 5.7053759519476444e-05\n",
      "epoch941, loss 5.6408480304526165e-05\n",
      "epoch942, loss 5.577081537921913e-05\n",
      "epoch943, loss 5.51573648408521e-05\n",
      "epoch944, loss 5.4534717492060736e-05\n",
      "epoch945, loss 5.391989179770462e-05\n",
      "epoch946, loss 5.330653948476538e-05\n",
      "epoch947, loss 5.27130214322824e-05\n",
      "epoch948, loss 5.212612450122833e-05\n",
      "epoch949, loss 5.1525690651033074e-05\n",
      "epoch950, loss 5.09507444803603e-05\n",
      "epoch951, loss 5.037168739363551e-05\n",
      "epoch952, loss 4.979843652108684e-05\n",
      "epoch953, loss 4.924027598462999e-05\n",
      "epoch954, loss 4.868981704930775e-05\n",
      "epoch955, loss 4.813802661374211e-05\n",
      "epoch956, loss 4.7599321987945586e-05\n",
      "epoch957, loss 4.7050554712768644e-05\n",
      "epoch958, loss 4.651590279536322e-05\n",
      "epoch959, loss 4.600811007549055e-05\n",
      "epoch960, loss 4.5496122766053304e-05\n",
      "epoch961, loss 4.496821929933503e-05\n",
      "epoch962, loss 4.447148603503592e-05\n",
      "epoch963, loss 4.3954711145488545e-05\n",
      "epoch964, loss 4.347777576185763e-05\n",
      "epoch965, loss 4.297684790799394e-05\n",
      "epoch966, loss 4.250527126714587e-05\n",
      "epoch967, loss 4.201565025141463e-05\n",
      "epoch968, loss 4.155312853981741e-05\n",
      "epoch969, loss 4.1063631215365604e-05\n",
      "epoch970, loss 4.061735307914205e-05\n",
      "epoch971, loss 4.015889498987235e-05\n",
      "epoch972, loss 3.9711016142973676e-05\n",
      "epoch973, loss 3.9265032683033496e-05\n",
      "epoch974, loss 3.8813072023913264e-05\n",
      "epoch975, loss 3.837368421955034e-05\n",
      "epoch976, loss 3.795350858126767e-05\n",
      "epoch977, loss 3.751386611838825e-05\n",
      "epoch978, loss 3.7094683648319915e-05\n",
      "epoch979, loss 3.667526470962912e-05\n",
      "epoch980, loss 3.6270277632866055e-05\n",
      "epoch981, loss 3.5862332879332826e-05\n",
      "epoch982, loss 3.546446168911643e-05\n",
      "epoch983, loss 3.5050074075115845e-05\n",
      "epoch984, loss 3.465871122898534e-05\n",
      "epoch985, loss 3.4269272873643786e-05\n",
      "epoch986, loss 3.388850745977834e-05\n",
      "epoch987, loss 3.35064651153516e-05\n",
      "epoch988, loss 3.311902401037514e-05\n",
      "epoch989, loss 3.2757270673755556e-05\n",
      "epoch990, loss 3.238021599827334e-05\n",
      "epoch991, loss 3.202024890924804e-05\n",
      "epoch992, loss 3.166039823554456e-05\n",
      "epoch993, loss 3.130709956167266e-05\n",
      "epoch994, loss 3.094452404184267e-05\n",
      "epoch995, loss 3.0602321203332394e-05\n",
      "epoch996, loss 3.0249788323999383e-05\n",
      "epoch997, loss 2.991904693772085e-05\n",
      "epoch998, loss 2.9589538826257922e-05\n",
      "epoch999, loss 2.9242644814075902e-05\n"
     ]
    }
   ],
   "source": [
    "epochs = 1000 \n",
    "for epoch in range(epochs):\n",
    "    inputs = x_train\n",
    "    labels = y_train\n",
    "    out = model(inputs)    \n",
    "    optimiser.zero_grad()    \n",
    "    loss = criterion(out, labels)    \n",
    "    loss.backward()    \n",
    "    optimiser.step()\n",
    "    predicted = model.forward(x_train)    \n",
    "    print('epoch{}, loss {}'.format(epoch, loss.item()))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OrderedDict([('linear.weight', tensor([[ 14.9984]])), ('linear.bias', tensor(1.00000e-03 *\n",
      "       [ 9.9932]))])\n"
     ]
    }
   ],
   "source": [
    "print(model.state_dict())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XlcVXX+x/HXR0ERR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OK0TgS9O0QksTLLixoKez9OZe/H/9h7\ncaqG9H7Y1I0xxng4C3pjjPFwnhD08U4XUMfY+3Eqez/+x96LUzWY96Pez9EbY4w5N084ozfGGHMO\n9TroRWSEiGwSka0iMsXpepwkIkEislxENojIehH5vdM1OU1EGovIahH5wOlanCYirURkvohsLP0e\nGeR0TU4RkQdLf0bWicjbIuLjdE01rd4G/Uk3IB8J9AImiEgvZ6tyVCHwR1XtCVwK3NfA3w+A31PS\nJtvALOATVQ0H+tJA3xcR6QTcD0Spah+gMSX3y/Bo9TboOekG5Kp6HDhxA/IGSVV3q+qPpV8fpuQH\nudru01vfiEggMAp41elanCYiLYErgDkAqnpcVQ86W5WjvIBmIuIF+HLa3e88UX0O+hq9AXl9JiKh\nwMXA985W4qjngEeAYqcLqQM6A1nA66VTWa+KSHOni3KCqu4C/ga4gN1Ajqp+5mxVNa8+B32FNyBv\niESkBbAAeEBVDzldjxNEZDSwV1WTnK6ljvAC+gEvqerFwFGgQX6mJSIXUPIv/zCgI9BcRH7lbFU1\nrz4HfYU3IG9oRMSbkpBPUNWFTtfjoMHAWBFJp2RK72oR+ZezJTkqA8hQ1RP/wptPSfA3RMOBNFXN\nUtUCYCFwmcM11bj6HPQ1egPy+kZEhJI52A2qOtPpepykqlNVNVBVQyn5vvhCVT3+rO1sVPUnYKeI\n9CgdGgakOliSk1zApSLiW/ozM4wG8MG0l9MFVJWqForIiRuQNwZeq84bkNdDg4GJQIqIrCkde1RV\nP3KwJlN3/A5IKD0p2g7c7nA9jlDV70VkPvAjJSvVVtMArpC1K2ONMcbD1eepG2OMMZVgQW+MMR7O\ngt4YYzycBb0xxng4C3pjjPFwFvTGGOPhLOiNMcbDWdAbY4yH+38eisOhwMK0IAAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f9a7979add8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "x = x_train.detach().numpy() \n",
    "plt.plot(x, predicted.detach().numpy(), label = 'predicted')\n",
    "plt.plot(x, y_train.detach().numpy(),'go', label = 'from data')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "torch.save(model.state_dict(), 'testmodel.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model = LinearModel(1,1)\n",
    "model.load_state_dict(torch.load('testmodel.pkl'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 9.9932e-03],\n",
       "        [ 1.5008e+01],\n",
       "        [ 3.0007e+01],\n",
       "        [ 4.5005e+01],\n",
       "        [ 6.0004e+01],\n",
       "        [ 7.5002e+01],\n",
       "        [ 9.0000e+01],\n",
       "        [ 1.0500e+02],\n",
       "        [ 1.2000e+02],\n",
       "        [ 1.3500e+02]])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predicted"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
